package chunmap.example.tool;

import java.awt.FlowLayout;
import java.awt.Image;
import java.io.IOException;

import javax.swing.JFrame;

import chunmap.util.image.WebClientUtil;

public class ImageGet {
	protected JFrame frame;
	
	public void init() {
		
		//create frame
		frame = new JFrame("温馨提示：滚珠缩放，右键拖动");
		frame.setLocation(100, 100);
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		frame.setSize(750, 600);
		frame.setLayout(new FlowLayout());
	
		//show frame
		frame.setVisible(true);
		
		//get map panel
		String url="http://ditu.google.cn/staticmap?center=40,116&zoom=0&size=255x360&maptype=satellite&key=MAPS_API_KEY&sensor=true_or_false";
		Image image;
		try {
			image = WebClientUtil.requestImage(url);
			frame.getGraphics().drawImage(image,0,0,frame);
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
	public static void main(String[] args){
		new ImageGet().init();
	}
}
